package com.example.sls.mapper.admin.defaultTable;

import com.example.sls.pojo.admin.defaultTable.EmpDt;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface EmpDtMapper {

    @Insert("insert into emp_dt values(#{id},#{workno},#{name},#{gender},#{age},#{idcard},#{address},#{entrydate});")
    Integer addData(EmpDt emp);   //在默认表增加数据

    @Update("update emp_dt set workno = #{workno}, name = #{name}, gender = #{gender}, age = #{age}, idcard = #{idcard}, address = #{address}, entrydate = #{entrydate} where id = #{id};")
    Integer updateData(Map<String,Object> emp);  //在修改默认表数据

    @Delete("delete from emp_dt where id = #{id};")
    Integer deleteData(@Param("id") Integer id);  //删除默认表数据

    @Select("select * from emp_dt")
    List<EmpDt> queryAllData();  //查询默认表全部数据

    //查询emp_dt表中的账号数量
    @Select("select count(*) from emp_dt;")
    Integer getCount();

    //查询emp_dt表中最大的id
    @Select("select max(id) from emp_dt;")
    Integer getMaxId();
}
